package com.github.ecbp.common.security.config;

import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

/**
 * 用于token配置
 */
@Data
@Component
@PropertySource("classpath:jwt.properties")
public class JwtTokenConfig {

    @Value("${ecbp.common.jwt.secret}")
    private String secret;
    @Value("${ecbp.common.jwt.salt}")
    private String salt;
    @Value("${ecbp.common.jwt.tokenHeader}")
    private String tokenHeader;
    @Value("${ecbp.common.redis.expiration}")
    private Integer expiration;
    @Value("${ecbp.common.jwt.expiration}")
    private Long jwtExpiration = 604800L;
    @Value("${ecbp.common.jwt.tokenSize}")
    private Integer tokenSize;
    @Value("#{'${ecbp.common.secure.login.ignored.urls}'.split(',')}")
    private List<String> loginUrls = new ArrayList<>();
    @Value("#{'${ecbp.common.secure.ignored.urls}'.split(',')}")
    private List<String> urls = new ArrayList<>();

}